package work20241226;

/**
 * @author zdl
 * @date 2024/12/26
 */
class PrintString implements Runnable{
    private String str;

    public PrintString(String str) {
        this.str = str;
    }

    @Override
    public void run() {
        System.out.println(str);
    }
}
public class Demo5 {
    public static void main(String[] args) {
        //5. 创建两个线程，分别打印传入的两个字符串"Hello"和"World"。
        new Thread(new PrintString("Hello")).start();
        new Thread(new PrintString("World")).start();
    }
}
